import config from '@/config/axios/config'
import { MockMethod } from 'vite-plugin-mock'

const { code } = config

const timeout = 1000

const adminList = [
  {
    path: '/dashboard',
    component: '#',
    redirect: '/dashboard/workplace',
    name: 'Dashboard',
    meta: {
      title: '首页',
      icon: 'ant-design:dashboard-filled',
      alwaysShow: true
    },
    children: [
      {
        path: 'workplace',
        component: 'views/Dashboard/Workplace',
        name: 'Workplace',
        meta: {
          title: '工作台',
          noCache: true,
          affix: true
        }
      }
    ]
  },
  {
    path: '/wellctrl',
    component: '#',
    redirect: '/wellctrl/well',
    name: 'WellCtrl',
    meta: {
      title: '压井模块',
      icon: 'icon-park-outline:protect',
      alwaysShow: true
    },
    children: [
      {
        path: 'well',
        component: 'views/WellCtrl/Well',
        name: 'Well',
        meta: {
          title: '重点关注井'
        }
      },
      {
        path: 'info',
        component: 'views/WellCtrl/Info',
        name: 'Info',
        meta: {
          title: '详情',
          noTagsView: true,
          noCache: true,
          hidden: true,
          showMainRoute: true,
          activeMenu: '/wellctrl/well'
        }
      }
    ]
  },
  {
    path: '/emergency',
    component: '#',
    redirect: '/emergency/warehouse',
    name: 'Emergency',
    meta: {
      title: '井控装备',
      icon: 'mdi:pipe-valve',
      alwaysShow: true
    },
    children: [
      {
        path: 'warehouse',
        component: 'views/Emergency/Warehouse',
        name: 'Warehouse',
        meta: {
          title: '仓库管理'
        }
      },
      {
        path: 'material',
        component: 'views/Emergency/Material',
        name: 'Material',
        meta: {
          title: '物资管理'
        }
      }, {
        path: 'category',
        component: 'views/Emergency/Category',
        name: 'Category',
        meta: {
          title: '物资分类管理'
        }
      },
      {
        path: 'stock',
        component: 'views/Emergency/Stock',
        name: 'Stock',
        meta: {
          title: '库存管理'
        }
      },
      {
        path: 'inbound',
        component: 'views/Emergency/Inbound',
        name: 'Inbound',
        meta: {
          title: '入库管理'
        }
      },
      {
        path: 'outbound',
        component: 'views/Emergency/Outbound',
        name: 'Outbound',
        meta: {
          title: '出库管理'
        }
      },
      {
        path: 'expert',
        component: 'views/Emergency/Expert',
        name: 'Expert',
        meta: {
          title: '专家管理'
        }
      }
    ]
  },
  {
    path: '/knowledge',
    component: '#',
    redirect: '/Knowledge/List',
    name: 'Knowledge',
    meta: {
      title: '知识库',
      icon: 'material-symbols:menu-book',
      alwaysShow: true
    },
    children: [
      {
        path: 'list',
        component: 'views/Knowledge/List',
        name: 'List',
        meta: {
          title: '知识库'
        }
      },
      {
        path: 'manage',
        component: 'views/Knowledge/Manage',
        name: 'Manage',
        meta: {
          title: '知识库管理'
        }
      },
      {
        path: 'category',
        component: 'views/Knowledge/KCategory',
        name: 'KCategory',
        meta: {
          title: '分类管理'
        }
      },
      {
        path: 'piece',
        component: 'views/Knowledge/Piece',
        name: 'Piece',
        meta: {
          title: '知识碎片管理',
          noTagsView: true,
          noCache: true,
          hidden: true,
          showMainRoute: true,
          activeMenu: '/Knowledge/List'
        }
      }, 
      {
        path: 'viewer',
        component: 'views/Knowledge/Viewer',
        name: 'Viewer',
        meta: {
          title: '知识浏览',
          noTagsView: true,
          noCache: true,
          hidden: true,
          showMainRoute: true,
          activeMenu: '/Knowledge/List'
        }
      }
    ]
  },
  {
    path: '/error',
    component: '#',
    redirect: '/error/404',
    name: 'Error',
    meta: {
      title: '错误',
      icon: 'ci:error',
      alwaysShow: true
    },
    children: [
      {
        path: '404-demo',
        component: 'views/Error/404',
        name: '404Demo',
        meta: {
          title: '404'
        }
      },
      {
        path: '403-demo',
        component: 'views/Error/403',
        name: '403Demo',
        meta: {
          title: '403'
        }
      },
      {
        path: '500-demo',
        component: 'views/Error/500',
        name: '500Demo',
        meta: {
          title: '500'
        }
      }
    ]
  }
]

const testList: string[] = [
  '/dashboard',
  '/dashboard/analysis',
  '/dashboard/workplace',
  'external-link',
  'https://element-plus-admin-doc.cn/',
  '/guide',
  '/guide/index',
  '/components',
  '/components/form',
  '/components/form/default-form',
  '/components/form/use-form',
  '/components/form/ref-form',
  '/components/table',
  '/components/table/default-table',
  '/components/table/use-table',
  '/components/table/tree-table',
  '/components/table/table-image-preview',
  '/components/table/ref-table',
  '/components/editor-demo',
  '/components/editor-demo/editor',
  '/components/search',
  '/components/descriptions',
  '/components/image-viewer',
  '/components/dialog',
  '/components/icon',
  '/components/echart',
  '/components/count-to',
  '/components/qrcode',
  '/components/highlight',
  '/components/infotip',
  '/Components/InputPassword',
  '/Components/Sticky',
  '/hooks',
  '/hooks/useWatermark',
  '/hooks/useCrudSchemas',
  '/level',
  '/level/menu1',
  '/level/menu1/menu1-1',
  '/level/menu1/menu1-1/menu1-1-1',
  '/level/menu1/menu1-2',
  '/level/menu2',
  '/example',
  '/example/example-dialog',
  '/example/example-page',
  '/example/example-add',
  '/example/example-edit',
  '/example/example-detail',
  '/error',
  '/error/404-demo',
  '/error/403-demo',
  '/error/500-demo'
]

export default [
  // 列表接口
  {
    url: '/role/list',
    method: 'get',
    timeout,
    response: ({ query }) => {
      const { roleName } = query
      return {
        code: code,
        data: roleName === 'admin' ? adminList : testList
      }
    }
  }
] as MockMethod[]
